Math.clamp = function(value, min, max)
{
	return value < min ? min : value > max ? max : value;
}

Math.absFloat = function(value)
{
	return value < 0 ? -value : value;
}

Math.absInt = function(value)
{
	var aux = value >> 31;
	return (value ^ aux) - aux;
}

Math.toInt = function(value)
{
	return ~~value;
}

Math.roundInt = function(value)
{
	return (0.5 + value) << 0;
}

Math.roundedAbs = function(value)
{
	return ~((0.5 + value) << 0);
}